#include"vector3.hpp"

using namespace std;

Vector3::Vector3(double x, double y, double z){
    X=x;
    Y=y;
    Z=z;
}


ostream& operator<<(std::ostream& out, const Vector3& v) {
    return out << v.X << ' ' << v.Y << ' ' << v.Z;
}

double Dot(const Vector3 &u, const Vector3 &v){
    return u.X*v.X+u.Y*v.Y+u.Z*v.Z;
}

Vector3 Vector3::Cross(const Vector3 &u, const Vector3 &v){
    return (Vector3(u.Y*v.Z-u.Z*v.Y, u.Z*v.X-u.X*v.Z, u.X*v.Y-u.Y*v.X));
}


Vector3 Vector3::operator-(const Vector3 &v){
    return Vector3(X-v.X, Y-v.Y, Z-v.Z);
}
Vector3 Vector3::operator+(const Vector3 &v){
    return Vector3(X+v.X, Y+v.Y, Z+v.Z);
}
void Vector3::operator+=(const Vector3 &v){
    X+=v.X;
    Y+=v.Y;
    Z+=v.Z;
}
void Vector3::operator-=(const Vector3 &v){
    X-=v.X;
    Y-=v.Y;
    Z-=v.Z;
}